home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / db / esm-3.1 / esm-3 / usr / local / sm / src / include / checking.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-05  |  3.5 KB  |  148 lines

  1. #ifndef _CHECKING_H_
  2. #define _CHECKING_H_
  3. /*
  4.  *   $RCSfile: checking.h,v $  
  5.  *   $Revision: 1.1.1.1 $  
  6.  *   $Date: 1996/05/04 21:55:07 $      
  7.  */ 
  8. /* BEGIN visible to user */
  9.  
  10. /**********************************************************************
  11. * EXODUS Database Toolkit Software
  12. * Copyright (c) 1991 Computer Sciences Department, University of
  13. *                    Wisconsin -- Madison
  14. * All Rights Reserved.
  15. *
  16. * Permission to use, copy, modify and distribute this software and its
  17. * documentation is hereby granted, provided that both the copyright
  18. * notice and this permission notice appear in all copies of the
  19. * software, derivative works or modified versions, and any portions
  20. * thereof, and that both notices appear in supporting documentation.
  21. *
  22. * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
  23. * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.  
  24. * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
  25. * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  26. *
  27. * The EXODUS Project Group requests users of this software to return 
  28. * any improvements or extensions that they make to:
  29. *
  30. *   EXODUS Project Group 
  31. *     c/o David J. DeWitt and Michael J. Carey
  32. *   Computer Sciences Department
  33. *   University of Wisconsin -- Madison
  34. *   Madison, WI 53706
  35. *
  36. *     or exodus@cs.wisc.edu
  37. *
  38. * In addition, the EXODUS Project Group requests that users grant the 
  39. * Computer Sciences Department rights to redistribute these changes.
  40. **********************************************************************/
  41.  
  42. /*
  43.  *    These values are used to define the assert
  44.  *    checking level of the compiled code
  45.  */
  46. #define LEVEL_1        1)
  47. #define LEVEL_2        2)
  48. #define LEVEL_3        3)
  49.  
  50.  
  51. #ifdef DEBUG
  52.  
  53. /*
  54.  *    This value control the level of assert
  55.  *    checking expansion for the current compile
  56.  */
  57. #define ASSERT_LEVEL        (3
  58.  
  59. #define MAGIC_CHECKING        ENABLED
  60.  
  61. #define OBJECT_MAGIC        DISABLED
  62.  
  63. #define LIST_CHECKING        ENABLED
  64.  
  65. #define PARAM_CHECKING        ENABLED
  66.  
  67. #define IO_STATISTICS        ENABLED
  68.  
  69.  
  70. #else
  71.  
  72.  
  73. /*
  74.  *    This value control the level of assert
  75.  *    checking expansion for the current compile
  76.  */
  77. #define ASSERT_LEVEL        (0
  78.  
  79. #define MAGIC_CHECKING    ENABLED
  80.  
  81. #define OBJECT_MAGIC        DISABLED
  82.  
  83. #define LIST_CHECKING        DISABLED
  84.  
  85. #define PARAM_CHECKING        DISABLED
  86.  
  87. #define IO_STATISTICS        ENABLED
  88.  
  89.  
  90. #endif
  91.  
  92. /* END visible to user */
  93.  
  94. #ifndef SERVER_MAKE
  95. /* CLIENT VERSION */
  96. /* BEGIN visible to user */
  97.  
  98. #define SM_ASSERT(_level, _condition)                            \
  99.     if (ASSERT_LEVEL >= _level)    {                                \
  100.         if (!(_condition))    {                                    \
  101.             SM_Error(TYPE_FATAL, esmASSERT, __FILE__, __LINE__);\
  102.         }                                                        \
  103.     }
  104.  
  105. /* END visible to user */
  106.  
  107. #else SERVER_MAKE
  108.  
  109. #ifdef DEBUG
  110.  
  111. BEGIN_EXTERNC
  112.     extern int SanityCheck();
  113. END_EXTERNC
  114.  
  115. #ifdef DISKPROC_MAKE
  116. #define SANITY (0)
  117. #else DISKPROC_MAKE
  118. #define SANITY SanityCheck() 
  119. #endif DISKPROC_MAKE
  120.  
  121. #else
  122.  
  123. /* SANITY can cause nothing else to get compiled  when !debug */
  124. #define SANITY (1)
  125.  
  126. #endif DEBUG
  127.  
  128. /* 
  129.  * NB: be careful with the following definition.
  130.  * The feebleminded compiler (on sparcs) can't
  131.  * figure out that (1 || (0>=3)) is a constant (FALSE)
  132.  * expression and it generates code for if(!(condition)) --
  133.  * causing linkage errors.
  134.  * So we have to use if(1) if(0>=3) ....
  135.  */ 
  136. #define SM_ASSERT(_level, _condition)                            \
  137.     if ( SANITY ) {    /* see NB above */                            \
  138.          if (ASSERT_LEVEL >= _level)    {                         \
  139.             if (!(_condition))    {                                \
  140.                 SM_Error(TYPE_FATAL, esmASSERT, __FILE__, __LINE__);\
  141.             }                                                    \
  142.         }                                                        \
  143.     }
  144.  
  145. #endif SERVER_MAKE
  146.  
  147. #endif /* _CHECKING_H_ */
  148.